<template>
  <div class="course-explain">
    <div
      class="course_explain pb16"
      :style="bordershow ? 'border-bottom: 1px solid #eeeeee;' : ''"
    >
      <div class="course_explain_title">
        <img
          :src="courseDetail.publishAvatar"
          :onerror="defalutUrl"
          class="explain_title_photo"
        />
        <div class="explain_title_text">
          <div class="title_text_name">{{ courseDetail.publishName }}</div>
          <div class="title_text_start" v-if="!courseDetail.publishType">
            <span>技术水平</span>
            <van-rate
              v-model="courseDetail.skillStar"
              :size="10"
              color="#E8541E"
              :readonly="true"
            />
          </div>
        </div>
      </div>
      <div class="course_explain_text pr16">
        {{ courseDetail.name }}
      </div>
      <div class="course_explain_tips pr16">
        <div class="explanin_tips_type" v-if="courseDetail.paid">付费解锁</div>
        <div class="explanin_tips_type" v-else>免费</div>
        <div class="explain_tips_seepeople">
          <span>{{ courseDetail.view || 0 }}</span>
          <span>观看</span>
        </div>
      </div>
      <div
        class="course_explain_password"
        v-if="courseDetail.courseTypeName == '直播课程'"
      >
        <div v-if="courseDetail.paid">
          直播密码:<span class="course_explain_password_text active"
            >付费获取</span
          >
        </div>
        <div v-else>
          直播密码:<span class="course_explain_password_text">{{
            courseDetail.password
          }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Rate from "vant/lib/rate";
import "vant/lib/rate/style";
export default {
  name: "course-explain",
  components: {
    VanRate: Rate,
  },
  props: {
    bordershow: Boolean,
    courseDetail: Object,
  },
  data() {
    return {
      value: 5,
      defalutUrl: 'this.src="' + require("@/assets/icon/avatar.png") + '"',
    };
  },
  computed: {},
  created() {},
  mounted() {},
  methods: {},
};
</script>

<style scoped lang="scss">
.course_explain {
  width: 100%;
  height: auto;
  // border-bottom: 1px solid #eeeeee;
}
.course_explain_title {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  .explain_title_photo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: hsl(0, 0%, 0%);
    margin-right: 16px;
  }
  .title_text_name {
    font-size: 17px;
    line-height: 24px;
  }
  .title_text_start {
    font-size: 10px;
    line-height: 14px;
    color: #666666;

    margin-top: 4px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    span {
      margin-right: 4px;
    }
  }
}
.course_explain_text {
  width: 100%;
  font-size: 16px;
  line-height: 24px;
  color: #333;
  font-weight: 600;
  margin-top: 22px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
}
.explanin_tips_type {
  font-size: 16px;
  line-height: 24px;
  color: #e8541e;
}
.course_explain_tips {
  width: 100%;
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  line-height: 17px;
  color: #999999;
}
.course_explain_password {
  width: 100%;
  height: 44px;
  background: #f9f9f9;
  opacity: 1;
  border-radius: 4px;
  margin: 0 auto;
  font-size: 16px;
  color: #333333;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
}
.course_explain_password_text {
  margin: 0 5px;
}
.course_explain_password_text.active {
  color: #e8541e;
}
</style>
